﻿<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/Areas/CustomerAdmin/Customer.Master" CodeBehind="ConfigDomain.aspx.cs" Inherits="OnlineBusinesses.Areas.CustomerAdmin.ConfigDNS" %>

<asp:Content runat="server" ID="BodyContent" ContentPlaceHolderID="ContentCustomerAdmin">
    <div class="col-md-12 col-xs-12 col-lg-12 col-sm-12" style="padding: 0px;">
        <h3>Tên miền đăng ký</h3>
        <div class="col-md-12 col-xs-12 col-sm-12 col-lg-12" style="padding: 0px;">
            <div class="col-md-12 col-xs-12 col-sm-12 col-lg-12" style="padding: 0px;">
                <div class="col-md-3 col-lg-3 col-sm-12 col-xs-12" style="padding: 5px 0px; line-height: 40px;">Vui lòng nhập tên miền của bạn</div>
                <div class="col-md-6 col-lg-6 col-sm-12 col-xs-12" style="padding: 5px 0px">
                    <asp:TextBox ID="txtCompanyDomain" runat="server" type="text" class="input_add" placeholder="vd: famails.com" />
                </div>

                <div class="col-md-3 col-lg-3 col-sm-12 col-xs-12" style="padding: 5px 0px; text-align: center;">
                    <asp:LinkButton ID="btnUpdateDomain" runat="server"
                        OnCommand="btnUpdateDomain_Click" class="btn btn-default"
                        Style="margin-right: 10px;border-radius: 0px; color: #fff; font-weight: bold;">Xác nhận</asp:LinkButton>
                    <span class="btn btn-default" style="border-radius: 0px; font-weight: bold;" onclick="openDETAILDNS();">Xem cấu hình</span>
                </div>
                <div class="col-md-12 col-xs-12 col-lg-12 col-sm-12" style="padding: 5px;">
                    <asp:Label runat="server" ID="lblStatus"></asp:Label>
                </div>
            </div>
            <div class="col-md-12 col-xs-12 col-sm-12 col-lg-12" id="detailDNS" style="padding: 10px 0px; display: none;">
                <div class="col-xs-12 col-md-12 col-lg-12 col-sm-12" style="padding: 0px;">
                    <div class="table-responsive">
                        <table class="table-bordered table table-striped">
                            <thead style="background: #333; color: #fff;">
                                <tr>
                                    <th style="padding-left: 20px;">Type</th>
                                    <th style="padding-left: 20px;">name</th>
                                    <th style="padding-left: 20px;">valid</th>
                                    <th style="padding-left: 20px;">value</th>
                                </tr>
                            </thead>
                            <tbody>
                                <asp:Repeater runat="server" ID="rpt_sending">
                                    <ItemTemplate>
                                        <tr>
                                            <td><%#Eval("record_type") %></td>
                                            <td><%#Eval("name") %></td>
                                            <td><%#Eval("valid") %></td>
                                            <td>
                                                <textarea style="width: 400px" readonly><%#Eval("value") %></textarea></td>
                                        </tr>
                                    </ItemTemplate>
                                </asp:Repeater>
                            </tbody>
                        </table>
                        <table class="table-bordered table table-striped">
                            <thead style="background: #333; color: #fff;">
                                <tr>
                                    <th style="padding-left: 20px;">Type</th>
                                    <th style="padding-left: 20px;">priority</th>
                                    <th style="padding-left: 20px;">valid</th>
                                    <th style="padding-left: 20px;">value</th>
                                </tr>
                            </thead>
                            <tbody>
                                <asp:Repeater runat="server" ID="rpt_recieving">
                                    <ItemTemplate>
                                        <tr>
                                            <td><%#Eval("record_type") %></td>
                                            <td><%#Eval("priority") %></td>
                                            <td><%#Eval("valid") %></td>
                                            <td>
                                                <textarea style="width: 400px;" readonly><%#Eval("value") %></textarea></td>
                                        </tr>
                                    </ItemTemplate>
                                </asp:Repeater>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="col-md-12 col-xs-12 col-lg-12 col-sm-12" style="padding: 0px; margin: 10px 0px; height: 1px; background: #ddd;"></div>
    <div class="col-md-12 col-xs-12 col-lg-12 col-sm-12" style="padding: 0px;">
        <script type="text/javascript">
            $(document).ready(function () {
                // prepare the data
                //var data = new Array();
                //var danhsach =
                //[
                //    "famails.com", "zing.vn", "shiphangmy.org",
                //];
                //var danhsach2 =
                //[
                //    "User@", "Admin@", "Info@",
                //];
                //var hoatdongs =
                //[
                //    "Đã đăng ký", "Chưa đăng ký"
                //];
                //var trangthais =
                //[
                //    "Bình thường"
                //];
                //for (var i = 0; i < 10; i++) {
                //    var row = {};
                //    row["firstname2"] = danhsach[Math.floor(Math.random() * danhsach.length)];
                //    row["firstname"] = danhsach2[Math.floor(Math.random() * danhsach2.length)] + danhsach[Math.floor(Math.random() * danhsach.length)] ;
                //    row["hoatdong"] = hoatdongs[Math.floor(Math.random() * hoatdongs.length)];
                //    row["trangthai"] = trangthais[Math.floor(Math.random() * trangthais.length)];
                //    data[i] = row;
                //}
                //var source =
                //{
                //    localdata: data,
                //    datatype: "array",
                //    datafields:
                //    [
                //        { name: 'firstname', type: 'string' },
                //        { name: 'firstname2', type: 'string' },
                //        { name: 'trangthai', type: 'string' },
                //        { name: 'hoatdong', type: 'string' }
                //    ]
                //};
                //var dataAdapter = new $.jqx.dataAdapter(source);

                //$("#jqxgrid").jqxGrid(
                //{
                //    width: $("#jqxgrid").width(),
                //    source: dataAdapter,
                //    selectionmode: 'multiplecellsadvanced',
                //    pageable: true,
                //    autoheight: true,
                //    sortable: true,
                //    columnsresize: true,
                //    columns: [
                //      { text: 'Tên cấu hình', dataField: 'firstname2' },
                //      { text: 'Email gửi', dataField: 'firstname', width: 180 },
                //      { text: 'Trạng thái đăng ký DNS', dataField: 'hoatdong', width: 180 },
                //      {
                //          text: 'Lấy cấu hình DNS', columntype: 'button', width: 150, cellsrenderer: function () {
                //              return "Lấy cấu hình DNS";
                //          }
                //      },
                //      { text: 'Trạng thái cấu hình', dataField: 'trangthai', width: 120 },
                //      {
                //          text: 'Chi tiết', columntype: 'button', width: 80, cellsrenderer: function () {
                //              return "xóa";
                //          }
                //      }
                //    ]
                //});
            });
        </script>
        <div class="col-md-12 col-xs-12 col-lg-12 col-sm-12" style="padding: 5px;">
            <div class="col-md-12 col-xs-12 col-lg-12 col-sm-12" style="padding: 5px;">
                Lưu ý : Đối với Email chưa được cấu hình DNS với FAmails, Quý khách chỉ được gửi tối đa 300mails/ngày
            </div>
        </div>
        <div id='jqxWidget' class="col-md-12 col-lg-12 col-xs-12 col-sm-12" style="padding: 10px;">
            <div id="jqxgrid" class="col-md-12 col-lg-12 col-xs-12 col-sm-12" style="padding: 0px;"></div>
        </div>
    </div>

    <%--     <script>
         jQuery(function () {
             $("#txtngaysinh").jqxDateTimeInput();
             var url = "Profile.aspx/LoadData";
             $.ajax({
                 type: "POST",
                 url: url,
                 contentType: "application/json; charset=utf-8",
                 dataType: "json",
                 success: function (data) {
                     $("#avatar").attr("src", data.d.Avatar);
                     $("#txtName").val(data.d.AccountName);
                     $("#txtdiachi").val(data.d.Address);
                     $("#txtemail").val(data.d.Email);
                     $("#txtchucvu").val(data.d.DepartmentName);
                     $("#txtcompanyname").val(data.d.TenCongTy);
                     $("#txtngaysinh").jqxDateTimeInput('val', data.d.BirthDay);
                     $("#txtsdt").val(data.d.Phone);
                 },
                 error: function (jqXHR, textStatus, errorThrown) {
                     // Handle errors here
                     console.log('ERRORS: ' + textStatus);
                     alert("Lưu không thành công!");
                     // STOP LOADING SPINNER
                 }
             });

             //$("#btnSave").click(function () {
             $(document).on('click', '#btnSave', function (event) {
                 var avatar = $("#avatar").attr("src");
                 var diachi = $("#txtdiachi").val();
                 var ngaysinh = $("#txtngaysinh").jqxDateTimeInput('getText');
                 var phone = $("#txtsdt").val();
                 //alert(ngaysinh);
                 var name = $("#txtName").val();
                 var url = "Profile.aspx/Save";
                 $.ajax({
                     type: "POST",
                     url: url,
                     data: "{avatar:'" + avatar + "', name:'" + name + "', phone:'" + phone + "', birthday:'" + ngaysinh + "', address:'" + diachi + "'}",
                     contentType: "application/json; charset=utf-8",
                     dataType: "json",
                     success: function (data) {
                         $("#master-avatar").attr("src", data.d.Avatar);
                         $("#master-avatar2").attr("src", data.d.Avatar);
                         alert('Cap nhat thanh cong.');
                     },
                     error: function (jqXHR, textStatus, errorThrown) {
                         // Handle errors here
                         console.log('ERRORS: ' + textStatus);
                         alert("Lưu không thành công!");
                         // STOP LOADING SPINNER
                     }
                 });
             });
         });
         </script>--%>
    <div class="col-md-12 col-xs-12 col-lg-12 col-sm-12" style="padding: 0px; margin: 10px 0px; height: 1px; background: #ddd;"></div>
    <%-- <div class="col-md-12 col-xs-12 col-lg-12 col-sm-12" style="padding: 0px;">
            <h3>Thông tin công ty</h3>
            <div class="col-md-12 col-xs-12 col-sm-12 col-lg-12" style="padding: 0px; margin-bottom: 5px;">
                <div class="col-md-2 col-lg-2 col-sm-12 col-xs-12" style="vertical-align: middle; text-align: center; padding: 15px 0px;">
                    <img class="img img-thumbnail" id="CompanyLogo" runat="server" style="cursor: pointer; width: 200px; height: 75px;" data-toggle="tooltip" data-placement="right" title="Hình ảnh đẹp tại 190 x 70" />
                    <input class="hidden" type="file" onchange="readURL2(this);" id="data_input" />
                </div>
                <div class="col-md-6 col-lg-6 col-sm-12 col-xs-12" style="vertical-align: middle; text-align: center; padding: 10px;">
                    <div class="col-md-12 col-xs-12 col-sm-12 col-lg-12" style="padding: 5px;">
                        <asp:TextBox ID="txtCompanyName" runat="server" type="text" class="input_add" placeholder="Tên công ty .." />
                    </div>
                    <div class="col-md-4 col-xs-12 col-lg-4 col-sm-12" style="padding: 5px;">
                        <asp:TextBox ID="txtCompanyPhone" runat="server" type="text" class="input_add" placeholder="Điện thoại .." />
                    </div>

                    <div class="col-md-4 col-xs-12 col-lg-4 col-sm-12" style="padding: 5px;">
                        <asp:TextBox ID="txtCompanyFax" runat="server" type="text" class="input_add" placeholder="Fax .." />
                    </div>
                    <div class="col-md-4 col-xs-12 col-lg-4 col-sm-12" style="padding: 5px;">
                        <asp:TextBox ID="txtCompanyEmail" runat="server" type="text" class="input_add" placeholder="Email .." />
                    </div>
                </div>
                <div class="col-md-4 col-xs-12 col-lg-4 col-sm-12" style="vertical-align: middle; text-align: center; padding: 10px;">
                    <asp:TextBox ID="txtCompanyAddress" runat="server" Style="height: 90px; resize: none;" TextMode="multiline" type="text" class="input_add" placeholder="Địa chỉ .." />
                </div>
            </div>
            <div class="col-md-12 col-xs-12 col-sm-12 col-lg-12" style="margin-bottom: 5px; text-align: right;">
                <asp:LinkButton ID="btnUpdate" runat="server"
                    OnCommand="btnUpdate_Click" class="btn btn-default"
                    Style="border-radius: 0px; background: #d00; color: #fff; font-weight: bold;">Cập nhật</asp:LinkButton>
            </div>
        </div>--%>
</asp:Content>
